<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
	request.setAttribute("sn_id", (int) (Math.random() * 100000));
	request.setAttribute("onSelect", request.getParameter("onSelect"));
	request.setAttribute("getTree", request.getParameter("getTree"));
	request.setAttribute("isCheck", request.getParameter("isCheck"));
	request.setAttribute("isRadio", request.getParameter("isRadio"));
	request.setAttribute("sessionId", request.getSession().getId());
%>
<script type="text/javascript">
var myTree_${sn_id};
	function initTree_${sn_id}() {
		myTree_${sn_id} = new dhtmlXTreeObject('treeboxbox_tree_${sn_id }', '100%', '100%', 0);
		myTree_${sn_id}.setImagePath("${basePath}scripts/dhtmlx/codebase/imgs/dhxtree_"+skin+"/");
	myTree_${sn_id}.enableRadioButtons(${isRadio eq true},"");
	 	myTree_${sn_id}.enableCheckBoxes(${isCheck eq true});
 		myTree_${sn_id}.enableThreeStateCheckboxes(${isCheck eq true});
		myTree_${sn_id}.attachEvent("onSelect", function(id, mode){
		    // your code here
		   ${onSelect}(id,myTree_${sn_id}.getItemText(id),myTree_${sn_id}.getParentId(id));
		});
	}
	function ${getTree}(){
		return myTree_${sn_id};
	}
</script>
<table style="width:98%;height:100%;margin-left:auto;margin-right:auto;" border="0">
	<tr>
		<td>
			<div id="treeboxbox_tree_${sn_id }" style="width: 100%;height: 100%;padding-top: 5px;padding-bottom: 5px"></div>
		</td>
	</tr>
</table>
<script type="text/javascript">
initTree_${sn_id}();
</script>